package com.example.flowabledemo.demos.flow.controller;

import com.example.flowabledemo.demos.flow.component.FormComponent;
import com.example.flowabledemo.demos.flow.entity.ProcessForm;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 表单测试
 * @Author: LuanKay
 * @Date: 2025/2/13
 */
@Slf4j
@RestController
@AllArgsConstructor
public class FormController {
    private final FormComponent formComponent;

    /**
     * 新增表单
     *
     * @param form 表单实体
     * @return 新增表单的id
     */
    @PostMapping("/form/add")
    public Long addForm(@RequestBody ProcessForm form) {
        return formComponent.addForm(form);
    }

    // 提交
    /**
     * {
     *   "isCommon" : 1,
     *   "sets" : [ {
     *     "fieldName" : "name",
     *     "type" : 1,
     *     "isRequired" : 1
     *   }, {
     *     "fieldName" : "age",
     *     "type" : 2,
     *     "isRequired" : 1
     *   } ]
     * }
     */

    // 审批
    /**
     * {
     *   "isCommon" : 1,
     *   "sets" : [ {
     *     "fieldName" : "value",
     *     "type" : 1,
     *     "isRequired" : 1
     *   }]
     * }
     */


}
